<?php

class Web_Admin_Pedidos_ActualizarEnvio extends Web_Admin_MainPage
{

    public function mainContent()
    {
        $this->add_css_link(BASE_WEB_ROOT . '/css/datepicker.css');
        $this->add_js_link(BASE_WEB_ROOT . '/js/datepicker.js');
        return $this->mostrarForm();
    }

    private function mostrarForm()
    {
        if (isset($_SESSION['error'])) {
            $error = $_SESSION['error'];
            unset($_SESSION['error']);
        }
        
        $adm_id = Ey::getPrm(3);

        $obj = new Web_Db_CarritoDireccion();
        $db = $obj->getAdapter();
        $rs = $db->fetchRow($obj->select()->where('dir_car_id=?', $adm_id));
        $date = explode('-', $rs->dir_fenvio);
        
        $motor = new Smarty_Engine();
        $motor->assign('usuario', $rs);
        $motor->assign('error', $error);
        $motor->assign('fecha', Web_Admin_Pedidos_Wgt_Fecha::render($date[2], $date[1], $date[0]));

        return $motor->fetch(ADMIN_PEDIDOS_DIR . DS . 'tpl' . DS . 'actualizar-envio.tpl');
    }

}
